<template>
  <!-- 首页导航栏 -->
  <div class="home-header flex">
    <div class="header-left float-left">
      <i class="iconfont iconfanhuijiantou back-icon"></i>
    </div>
    <div class="header-input flex items-center flex-1">
      <i class="iconfont iconsousuo"></i>
      搜索美食/景点/攻略/新鲜事
    </div>
    <div class="header-right float-right text-center" @click="goCity()">
      {{ city }}
      <i class="iconfont iconxialajiantouxiao city-icon"></i>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    ...mapState(['city']),
  },
  methods: {
    goCity() {
      this.$router.push('/city')
    },
  },
}
</script>

<style lang="scss" scoped>
.home-header {
  line-height: 0.43rem;
  background: #fff;
  .header-left {
    width: 0.32rem;
    text-align: center;
    .back-icon {
      font-size: 0.2rem;
    }
  }
  .header-input {
    height: 0.32rem;
    line-height: 0.32rem;
    margin-top: 0.06rem;
    margin-left: 0.1rem;
    padding-left: 0.1rem;
    background: #fff;
    border: 0.01rem solid $border-color;
    border-radius: 0.05rem;
    color: $gray;
    .iconfont {
      margin-right: 0.05rem;
    }
  }
  .header-right {
    min-width: 0.52rem;
    padding: 0 0.05rem;
    .city-icon {
      font-size: 0.12rem;
    }
  }
}
</style>
